set(lua_directory lua-5.1.4)

if(CMAKEPORTS_ASSEMBLE)
    # This section is used only in CMakePorts SVN
    set(lua_directory ${lua_directory} PARENT_SCOPE)
    set(lua_tarball   lua-5.1.4.tar.gz PARENT_SCOPE)
    set(lua_url http://www.lua.org/ftp/lua-5.1.4.tar.gz PARENT_SCOPE)
    set(lua_patches
        lua-5.1.4_cmp.diff
        PARENT_SCOPE)
endif()

if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${lua_directory}")
    add_subdirectory(${lua_directory})
endif()

# Compatibility settings for interoperability with FindLUA.cmake
set(LUA_FOUND 1 CACHE INTERNAL "Found LUA")
set(LUA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${lua_directory}/src CACHE INTERNAL "Lua include dir")
set(LUA_LIBRARY   ${CMAKEPORTS_NAME_PREFIX}liblua51 CACHE INTERNAL "Lua Library")
set(LUA_LIBRARIES ${CMAKEPORTS_NAME_PREFIX}liblua51 CACHE INTERNAL "Lua Libraries")
set(NATIVE_LUA_LIB_PATH ${CMAKE_BINARY_DIR}/ports/lua/${lua_directory} CACHE INTERNAL "deprecated")
